/**
 * Created by xiaopingfeng on 9/30/17.
 */

var log4js = require('log4js')
log4js.configure({
  appenders: {
    terminal: {type: 'stdout'},
    services: {type: 'file', filename: 'service.log'},
    raw: {type: 'file', filename: 'raw.log'},
  },
  categories: {
    default: {appenders: ['services', 'terminal'], level: 'debug'},
    raw: {appenders: ['raw'], level: 'info'},
  }
})
var logger = log4js.getLogger('services')
logger.level = 'debug'

const fs = require('fs-extra')
const path = require('path')

var DATA_DIR = 'data'
var DATA_RAW_DIR = path.join(DATA_DIR, 'raw')
var DATA_FRAME_DIR = path.join(DATA_DIR, 'frame')
var DATA_RESULT_DIR = path.join(DATA_DIR, 'result')

fs.ensureDirSync(DATA_DIR)
fs.ensureDirSync(DATA_RAW_DIR)
fs.ensureDirSync(DATA_FRAME_DIR)
fs.ensureDirSync(DATA_RESULT_DIR)

var MOCKUP = true

require('./services/web')
require('./services/message_server')
require('./services/raw_frame')
// require('./services/raw_parser')
if (MOCKUP) {
  require('./services/raw_mock_pub')
  require('./services/wrapper_mock')
  require('./services/wrapper_mock1')
  require('./services/wrapper_mock2')
}

logger.info("run_all", MOCKUP);
